/*
 * Geometry.h
 *
 *  Created on: 22 juil. 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#ifndef GEOMETRY_H_
#define GEOMETRY_H_

class Size;

class Point
{
private:
	int x, y;
public:
	Point();
	Point(int x, int y);
	Point(const Point &point);
	int X() const;
	int Y() const;
	Point &operator =(const Point & point);
	operator Size() const;
	Point operator +(const Size &size) const;
	Point &operator +=(const Size &size);
};

class Size
{
private:
	int w, h;
public:
	Size();
	Size(int w, int h);
	Size(const Size & size);
	int W() const;
	int H() const;
	Size &operator =(const Size &size);
	operator Point() const;
	Size operator +(const Size &size) const;
	Size &operator +=(const Size &size);
};

class Rect
{
	int x1, x2, y1, y2;
public:
	Rect();
	Rect(int x1, int y1, int x2, int y2);
	Rect(const Point &point, const Size &size);
	Rect(const Rect &rect);
	int X() const;
	int Y() const;
	int W() const;
	int H() const;
	operator Point() const;
	operator Size() const;
	Rect &operator =(const Rect &rect);
	Rect operator +(const Point &point) const;
	Rect &operator +=(const Point &point);
	Rect operator +(const Size &size) const;
	Rect &operator +=(const Size &size);
	Rect &Union(const Rect &other);
};

#endif /* GEOMETRY_H_ */
